<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="ReturnInvoice.aspx.cs" Inherits="Admin_ReturnInvoice" Title="ReturnInvoice List" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    Check Invoice List</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <script src="myscript/ReturnInvoice.js" type="text/javascript"></script>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Panel runat="server" ID="pn_Add" DefaultButton="btn_Add">
                <table>
                    <tr>
                        <td>
                            Invoice Number:
                        </td>
                        <td>
                            <asp:TextBox ID="tb_InvoiceNumber" CssClass="text-input" runat="server" MaxLength="10"
                                Width="100px" AutoComplete="Off"></asp:TextBox>
                        </td>
                        <td>
                            Reason:
                        </td>
                        <td>
                            <asp:TextBox ID="tb_Reason" CssClass="text-input" Width="400px" runat="server"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Button ID="btn_Add" runat="server" Text="Add" CssClass="button" OnClick="btn_Add_Click" />
                            <asp:Button ID="btn_Print" runat="server" Text="Print" CssClass="button" OnClick="btn_Print_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <data:EntityGridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="AllInvoiceDataSource"
                AllowMultiColumnSorting="False" DefaultSortColumnName="ReturnedDate" DefaultSortDirection="Descending"
                AllowPaging="True" ExcelExportFileName="Export_CheckInvoice.xls" AllowExportToExcel="True"
                AllowSorting="True" ExportToExcelText="Excel" PageSelectorPageSizeInterval="10"
                RecordsCount="0" ShowGridOnEmptyData="False">
                <Columns>
                    <asp:CommandField ShowDeleteButton="True" DeleteText="Remove" />
                    <asp:BoundField DataField="VatInvoiceNumber" HeaderText="Invoice Number" SortExpression="VatInvoiceNumber" />
                    <asp:BoundField DataField="DateVisit" HeaderText="Invoice Date" SortExpression="DateVisit" />
                    <asp:BoundField DataField="PatientCode" HeaderText="PatientCode" SortExpression="PatientCode" />
                    <asp:BoundField DataField="PatientName" HeaderText="PatientName" SortExpression="PatientName" />
                    <asp:BoundField DataField="PaymentMode" HeaderText="PaymentMode" SortExpression="PaymentMode" />
                    <asp:BoundField DataField="ReturnedDate" HeaderText="ReturnedDate" SortExpression="ReturnedDate" />
                    <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="Remark" />
                    <asp:BoundField DataField="TotalProcedure" HeaderText="Total Procedure" SortExpression="TotalProcedure"
                        DataFormatString="{0:#,##0}">
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                    <asp:BoundField DataField="TotalPharmacy" HeaderText="Total Pharmacy" SortExpression="TotalPharmacy"
                        DataFormatString="{0:#,##0}">
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                    <asp:BoundField DataField="TotalAmountVnd" HeaderText="Total Amount Vnd" SortExpression="TotalAmountVnd"
                        DataFormatString="{0:#,##0}">
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                    <asp:BoundField DataField="TotalAmountUsd" HeaderText="Total Amount Usd" SortExpression="TotalAmountUsd"
                        DataFormatString="{0:#,##0.00}">
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                    <asp:BoundField DataField="ExchangeRate" HeaderText="Ex Rate" SortExpression="ExchangeRate"
                        DataFormatString="{0:#,##0}">
                        <ItemStyle HorizontalAlign="Right" />
                    </asp:BoundField>
                </Columns>
                <EmptyDataTemplate>
                    <b>No Return Invoices Found!</b>
                </EmptyDataTemplate>
            </data:EntityGridView>
            <br />
            <data:AllInvoiceDataSource ID="AllInvoiceDataSource" runat="server" SelectMethod="GetPaged"
                EnablePaging="True" EnableSorting="True">
                <Parameters>
                    <data:CustomParameter Name="WhereClause" Value=" Received=0  AND DATEDIFF(d,ReturnedDate,GETDATE())=0"
                        ConvertEmptyStringToNull="false" />
                    <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
                    <asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex"
                        Type="Int32" />
                    <asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize"
                        Type="Int32" />
                    <data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
                </Parameters>
            </data:AllInvoiceDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
